﻿using AnQinFrameWorkAPI.Entity.Develop.DTO.DevelopProjectSales;
using AnQinFrameWorkAPI.Entity.Develop.View.DevelopProjectSales;
using AnQinFrameWorkAPI.Service.Develop;
using FrameWork.Entity;
using Microsoft.AspNetCore.Mvc;

namespace AnQinFrameWorkAPI.Controllers.Develop;

/// <summary>
///     开发管理项目销售
/// </summary>
[Route("api/[controller]")]
[ApiController]
[ApiExplorerSettings(GroupName = "Develop")]
public class DevelopProjectSaleController : ControllerBase
{
    //业务服务接口
    private readonly DevelopProjectSaleService _developProjectSaleService;

    //构造注入
    public DevelopProjectSaleController(DevelopProjectSaleService developProjectSaleService)
    {
        _developProjectSaleService = developProjectSaleService;
    }

    /// <summary>
    ///     获取开发管理项目销售列表
    /// </summary>
    /// <param name="developProjectSalesSearchDTO"></param>
    [ProducesResponseType(typeof(DevelopProjectSalesView), 200)]
    [HttpGet]
    public async Task<IActionResult> GetDevelopProjectDemandList(
        [FromQuery] DevelopProjectSalesSearchDTO developProjectSalesSearchDTO)
    {
        var response = await _developProjectSaleService.GetProjectSale(developProjectSalesSearchDTO);
        return StatusCode(response.Status, response);
    }

    /// <summary>
    ///     新增开发管理项目销售
    /// </summary>
    /// <param name="developProjectSalesAddDTO"></param>
    [HttpPost]
    public async Task<IActionResult> AddDevelopProjectDemand(
        [FromBody] DevelopProjectSalesAddDTO developProjectSalesAddDTO)
    {
        var response = await _developProjectSaleService.AddDevelopProjectSale(developProjectSalesAddDTO);
        return StatusCode(response.Status, response);
    }

    /// <summary>
    ///     更新开发管理项目销售
    /// </summary>
    /// <param name="developProjectSalesUpadteDTO"></param>
    [HttpPut]
    public async Task<IActionResult> PutDevelopProjectDemand(
        [FromBody] DevelopProjectSalesUpdateDTO developProjectSalesUpadteDTO)
    {
        var response = await _developProjectSaleService.PutDevelopProjectSale(developProjectSalesUpadteDTO);
        return StatusCode(response.Status, response);
    }

    /// <summary>
    ///     删除开发管理项目销售
    /// </summary>
    /// <param name="deleteDTO"></param>
    [HttpDelete]
    public async Task<IActionResult> DeleteDevelopProjectDemand([FromBody] SingleIdDTO deleteDTO)
    {
        var response = await _developProjectSaleService.DeleteDevelopProjectSale(deleteDTO);
        return StatusCode(response.Status, response);
    }

    /// <summary>
    ///     批量删除开发管理项目销售
    /// </summary>
    /// <param name="idArrayDTO"></param>
    [HttpPost("DeleteMulti")]
    public async Task<IActionResult> DeleteArrayDevelopProjectDemand([FromBody] IdArrayDTO idArrayDTO)
    {
        var response = await _developProjectSaleService.DeleteArrayDevelopProjectSale(idArrayDTO);
        return StatusCode(response.Status, response);
    }

    /// <summary>
    ///     开发管理项目销售 - 沟通中
    /// </summary>
    /// <param name="idArrayDTO"></param>
    [HttpPost("CommunicateMulti")]
    public async Task<IActionResult> CommunicateArrayDevelopProjectDemand([FromBody] IdArrayDTO idArrayDTO)
    {
        var response = await _developProjectSaleService.CommunicateArrayDevelopProjectSale(idArrayDTO);
        return StatusCode(response.Status, response);
    }

    /// <summary>
    ///     开发管理项目销售 - 项目金额
    /// </summary>
    /// <param name="developProjectSalesAmountDTO"></param>
    [HttpPost("Amount")]
    public async Task<IActionResult> AmountDevelopProjectDemand(
        [FromBody] DevelopProjectSalesAmountDTO developProjectSalesAmountDTO)
    {
        var response = await _developProjectSaleService.AmountDevelopProjectSale(developProjectSalesAmountDTO);
        return StatusCode(response.Status, response);
    }

    /// <summary>
    ///     开发管理项目销售 - 下定项目
    /// </summary>
    /// <param name="developProjectSalesPayAmountDTO"></param>
    [HttpPost("DepositAmount")]
    public async Task<IActionResult> DepositAmountDevelopProjectSale(
        [FromBody] DevelopProjectSalesPayAmountDTO developProjectSalesPayAmountDTO)
    {
        var response =
            await _developProjectSaleService.DepositAmountDevelopProjectSale(developProjectSalesPayAmountDTO);
        return StatusCode(response.Status, response);
    }

    /// <summary>
    ///     开发管理项目销售 - 付款
    /// </summary>
    /// <param name="developProjectSalesPayAmountDTO"></param>
    [HttpPost("PayAmount")]
    public async Task<IActionResult> PayAmountDevelopProjectDemand(
        [FromBody] DevelopProjectSalesPayAmountDTO developProjectSalesPayAmountDTO)
    {
        var response = await _developProjectSaleService.PayAmountDevelopProjectSale(developProjectSalesPayAmountDTO);
        return StatusCode(response.Status, response);
    }

    /// <summary>
    ///     开发管理项目销售 - 完成
    /// </summary>
    /// <param name="idArrayDTO"></param>
    [HttpPost("FinishMulti")]
    public async Task<IActionResult> FinishArrayDevelopProjectDemand([FromBody] IdArrayDTO idArrayDTO)
    {
        var response = await _developProjectSaleService.FinishArrayDevelopProjectSale(idArrayDTO);
        return StatusCode(response.Status, response);
    }

    /// <summary>
    ///     开发管理项目销售 - 取消
    /// </summary>
    /// <param name="idArrayDTO"></param>
    [HttpPost("CancelMulti")]
    public async Task<IActionResult> CancelArrayDevelopProjectDemand([FromBody] IdArrayDTO idArrayDTO)
    {
        var response = await _developProjectSaleService.CancelArrayDevelopProjectSale(idArrayDTO);
        return StatusCode(response.Status, response);
    }
}